﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace UI.Control
{
    public partial class ImageButton : Button
    {
        public Image SelectedImage { get; set; }
        public override Image BackgroundImage
        {
            get
            {
                return btn.BackgroundImage;
            }
            set
            {
                btn.BackgroundImage = value;
            }
        }
        private bool _Checked;
        public override bool Checked
        {
            get
            {
                return _Checked;
            }
            set
            {
                //base.Checked = value;
                _Checked = value;
                if (_Checked)
                {
                    this.btn.BackgroundImage = SelectedImage;
                    this.btn.FlatStyle = FlatStyle.Popup;
                    this.ShowText = "";
                }
                else
                {
                    this.btn.BackgroundImage = null;
                    this.btn.FlatStyle = FlatStyle.Standard;
                    //this.ShowText = this.Value;
                }
            }
        }
        public ImageButton()
        {
            InitializeComponent();
            this.BackgroundImageLayout = ImageLayout.Center;
        }
    }
}
